package com.ildan.app.toilet;

import java.util.ArrayList;

import com.ildan.app.util.AddrData;
import com.ildan.app.util.SearchCustomAdapter;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

public class SearchToiletList extends ListActivity{

	private ArrayList<AddrData> searchList;
	private SearchCustomAdapter adapter;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.search_list);
		searchList = getIntent().getParcelableArrayListExtra("searchListDelivery");
		adapter = new SearchCustomAdapter(this, searchList, R.layout.custom_view);
		setListAdapter(adapter);
	}
	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		// TODO Auto-generated method stub
		super.onListItemClick(l, v, position, id);
		Intent intent = new Intent();
		intent.putExtra("lat", adapter.getLat(position));
		intent.putExtra("lng", adapter.getLng(position));
		intent.putExtra("_id", id);
		setResult(RESULT_OK, intent);
		finish();
	}

	
}
